use leptos::prelude::*;

/// Card Component
#[component]
#[must_use]
pub fn UiCard(#[prop(optional)] class: Option<String>, children: Children) -> impl IntoView {
    let base = "overflow-hidden rounded-md bg-white shadow dark:bg-gray-800";
    let class = class.map_or_else(|| base.to_string(), |c| format!("{base} {c}"));

    view! {
        <div class=class>
            <div class="px-4 py-5 sm:p-6">
                {children()}
            </div>
        </div>
    }
}
